<? // Pagina solo para desarrollo
include('inc-login.php');

		$txt.='<form method="post" action="dev_db2.php"><input type="text" style="width:500px;" name="consulta"><input type="submit"></form><br>';
		
		if (isset($_POST['consulta'])) {
			$cons = $_POST['consulta'];
			$consulta = $cons;
			//mysql_query($consulta);
			$txt.= '<b>' . $cons . '</b>';
		}

		
		$txt.= '<form method="post" action="dev_db2.php"><select name="tabla">
					<option value="res"></option>
					<option value="chats">Chats</option>
					<option value="docs">Documentos</option>
					<option value="muvi_cat">Categorias</option>
					<option value="muvi_config">Configuracion</option>
					<option value="muvi_cuentas">Cuentas</option>
					<option value="muvi_estudios">Cargos</option>
					<option value="muvi_estudios_users">Estudios</option>
					<option value="muvi_examenes">Examenes</option>
					<option value="muvi_partidos">Partidos</option>
					<option value="users">Usuarios</option>
				</select><input type="submit"></form>';
		
		if ( (isset($_POST['tabla'])) && ($_POST['tabla'] != "res") ){
		$txt .= '<table border="0">';
			switch ($_POST['tabla']) {
				case "chats":
					$result = mysql_query("SELECT chat_ID, estado, pais, url, titulo, user_ID, admin FROM chats ORDER BY chat_ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['chat_ID'] . "</b></td><td> "
						. $r['url'] . "</td><td>"
						. $r['estado'] . "</td><td>"
						. $r['pais'] . "</td><td>"
						. $r['titulo'] . "</td><td>"
						. $r['user_ID'] . "</td><td>"
						. $r['admin'] . "</td></tr>"; }
					$txt .= "</table>";					break;
				case "docs":
					$result = mysql_query("SELECT ID, pais, url, title FROM docs ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['pais'] . "</td><td>"
						. $r['url'] . "</td><td>"
						. $r['title'] . "</td></tr>"; }
					$txt .= "</table>";	
					break;
				case "muvi_cat":
					$result = mysql_query("SELECT ID, url, nombre, num, nivel, tipo, orden FROM muvi_cat ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['url'] . "</td><td>"
						. $r['nombre'] . "</td><td>"
						. $r['num'] . "</td><td>"
						. $r['nivel'] . "</td><td>"
						. $r['tipo'] . "</td><td>"
						. $r['orden'] . "</td></tr>"; }
					$txt .= "</table>";
					break;
				case "muvi_config":
					$result = mysql_query("SELECT ID, dato, valor, autoload FROM muvi_config ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['dato'] . "</td><td>"
						. $r['valor'] . "</td><td>"
						. $r['autoload'] . "</td></tr>"; }
					$txt .= "</table>";	
				break;
				case "muvi_cuentas":
					$result = mysql_query("SELECT ID, nombre, user_ID, pols, nivel FROM muvi_cuentas ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['nombre'] . "</td><td>"
						. $r['user_ID'] . "</td><td>"
						. $r['pols'] . "</td><td>"
						. $r['nivel'] . "</td></tr>"; }
					$txt .= "</table>";
				break;
				case "muvi_estudios":
					$result = mysql_query("SELECT ID, nombre, nivel, num_cargo, asigna, salario FROM muvi_estudios ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['nombre'] . "</td><td>"
						. $r['nivel'] . "</td><td>"
						. $r['num_cargo'] . "</td><td>"
						. $r['asigna'] . "</td><td>"
						. $r['salario'] . "</td></tr>"; }
					$txt .= "</table>";
					break;					
				case "muvi_estudios_users":
					$result = mysql_query("SELECT ID, ID_estudio, user_ID, cargo, nota FROM muvi_estudios_users ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['user_ID'] . "</td><td>"
						. $r['ID_estudio'] . "</td><td>"
						. $r['nota'] . "</td><td>"
						. $r['cargo'] . "</td></tr>"; }
					$txt .= "</table>";
					break;	
				case "muvi_examenes":
					$result = mysql_query("SELECT ID, titulo, user_ID, cargo_ID FROM muvi_examenes ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['user_ID'] . "</td><td>"
						. $r['titulo'] . "</td><td>"
						. $r['cargo_ID'] . "</td></tr>"; }
					$txt .= "</table>";
					break;
				case "muvi_partidos":
					$result = mysql_query("SELECT ID, ID_presidente, siglas, nombre FROM muvi_partidos ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['ID_presidente'] . "</td><td>"
						. $r['siglas'] . "</td><td>"
						. $r['nombre'] . "</td></tr>"; }
					$txt .= "</table>";
					break;
				case "users":
					$result = mysql_query("SELECT ID, nick, pais, pols, estado, avatar, email FROM users ORDER BY ID", $link);
					while ($r = mysql_fetch_array($result)) { $txt .= "<tr><td><b>"
						. $r['ID'] . "</b></td><td> "
						. $r['nick'] . "</td><td>"
						. $r['pais'] . "</td><td>"
						. $r['pols'] . "</td><td>"
						. $r['estado'] . "</td><td>"
						. $r['email'] . "</td><td>"
						. $r['avatar'] . "</td></tr>"; 
					}
					$txt .= "</table>";
					break;	
			}//fi switch
		}//fi if

		
		
		
		
		$txt_title = "Acceso DB";
		if ($pol['nick'] != "frei"){
			$txt = "It Works! <br>";
		}	

include('theme.php');
?>
